import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    redirect: "/caseShow/groupBuying/ActivityShow/",
  },
  {
    path: "/caseShow/applyActivity/ActivityShow/:id",
    name: "活动报名",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/applyActivity/ActivityShow.vue"),
  },
  {
    path: "/caseShow/applyActivity/applyForm",
    name: "我要报名",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/applyActivity/ApplyForm.vue"),
  },
  {
    path: "/caseShow/applyActivity/ApplyPZ",
    name: "报名凭证",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/applyActivity/ApplyPZ.vue"),
  },
  {
    path: "/caseShow/lottoActivity/ApplyPZS",
    name: "报名凭证",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/lottoActivity/ApplyPZS.vue"),
  },
  {        
    path: "/caseShow/groupBuying/ActivityShow/:id",
    name: "拼团活动",
    component: () =>
    import(/* webpackChunkName: "about" */ "./views/caseShow/groupBuying/ActivityShow.vue"),
  }, 
  {
    path: "/caseShow/groupBuying/ApplyForm",
    name: "参与活动",
    component: () =>
    import(/* webpackChunkName: "about" */ "./views/caseShow/groupBuying/ApplyForm.vue"),
  },
  {
    path: "/caseShow/groupBuying/ApplyFormAgain",
    name: "重新付款",
    component: () =>
    import(/* webpackChunkName: "about" */ "./views/caseShow/groupBuying/ApplyFormAgain.vue"),
  },
  {
    path: "/caseShow/groupBuying/GroupDetails/:id",
    name: "拼团活动详情",
    component: () =>
    import(/* webpackChunkName: "about" */ "./views/caseShow/groupBuying/GroupDetails.vue"),
  },
  {
    path: "/caseShow/groupBuying/GroupMy",
    name: "我的参团",
    component: () =>
    import(/* webpackChunkName: "about" */ "./views/caseShow/groupBuying/GroupMy.vue"),
  },
  {
    path: "/caseShow/groupBuying/GroupOrder",
    name: "我的订单",
    component: () =>
    import(/* webpackChunkName: "about" */ "./views/caseShow/groupBuying/GroupOrder.vue"),
  },
  {
    path: "/caseShow/groupBuying/GroupEnvelope",
    name: "红包列表",
    component: () =>
    import(/* webpackChunkName: "about" */ "./views/caseShow/groupBuying/GroupEnvelope.vue"),
  },
  {
    path: "/caseShow/groupBuying/ApplyPZ",
    name: "拼团核销",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/groupBuying/ApplyPZ.vue"),
  },
  {
    path: "/caseShow/money/WithdrawDeposit",
    name: "我的余额",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/money/WithdrawDeposit.vue"),
  },
  {
    path: "/caseShow/money/CheckDetails",
    name: "余额明细",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/money/CheckDetails.vue"),
  },
  {
    path: "/caseShow/lottoActivity/ActivityShow/:id",
    name: "幸运抽奖",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/lottoActivity/ActivityShow.vue"),
  },
  {
    path: "/caseShow/lottoActivity/ApplyPZ",
    name: "抽奖凭证",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/lottoActivity/ApplyPZ.vue"),
  },
  {        
    path: "/caseShow/envelopesTalk/ActivityShow/:id",
    name: "红包拓客",
    component: () =>
    import(/* webpackChunkName: "about" */ "./views/caseShow/envelopesTalk/ActivityShow.vue"),
  }, 
  {
    path: "/caseShow/envelopesTalk/ApplyForm",
    name: "参与活动",
    component: () =>
    import(/* webpackChunkName: "about" */ "./views/caseShow/envelopesTalk/ApplyForm.vue"),
  },
  {
    path: '/caseShow/envelopesTalk/ApplyForms',
    name: "领取",
    component: () =>
    import(/* webpackChunkName: "about" */ "./views/caseShow/envelopesTalk/ApplyForms.vue"),
  },
  {
    path: "/caseShow/envelopesTalk/GroupOrder",
    name: "订单",
    component: () =>
    import(/* webpackChunkName: "about" */ "./views/caseShow/envelopesTalk/GroupOrder.vue"),
  },
  {
    path: "/caseShow/envelopesTalk/ApplyPZ",
    name: "核销订单",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/envelopesTalk/ApplyPZ.vue"),
  },
  {
    path: "/caseShow/bargaining/ApplyPZ",
    name: "核销订单",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/bargaining/ApplyPZ.vue"),
  },
  {
    path: "/caseShow/envelopesTalk/AdressForm",
    name: "抽奖地址",
    component: () =>
    import(/* webpackChunkName: "about" */ "./views/caseShow/envelopesTalk/AdressForm.vue"),
  },
  {
    path: "/caseShow/envelopesTalk/WithdrawDeposit",
    name: "我的余额",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/envelopesTalk/WithdrawDeposit.vue"),
  },
  {
    path: "/caseShow/envelopesTalk/CheckDetails",
    name: "余额明细",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/envelopesTalk/CheckDetails.vue"), 
  },
  {
    path: "/caseShow/scratchablelatex/ActivityShow/:id",
    name: "九宫格抽奖",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/scratchablelatex/ActivityShow.vue"),
  },
  // {
  //   path: "/caseShow/map/map",
  //   name: "百度地图",
  //   component: () =>
  //     import(/* webpackChunkName: "about" */ "./views/caseShow/map/map.vue"),
  // },
  {
    path: "/caseShow/solitaireplug/ActivityShow/:id",
    name: "接龙",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/solitaireplug/ActivityShow.vue"),
  },
  {
    path: "/caseShow/solitaireplug/OrderDetails",
    name: "参与人群",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/solitaireplug/OrderDetails.vue"),
  },
  {
    path: '/caseShow/eventCoupons/ActivityShow/:id',
    name: '优惠券',
    component: () => import(/* webpackChunkName: "about" */ "@/views/caseShow/eventCoupons/ActivityShow.vue")
  },
  {
    path: '/caseShow/helpActivity/ActivityShow/:id',
    name: '助力',
    component: () => import(/* webpackChunkName: "about" */ "@/views/caseShow/helpActivity/ActivityShow.vue")
  },
  {
    path: '/caseShow/bargaining/ActivityShow/:id',
    name: '砍价',
    component: () => import(/* webpackChunkName: "about" */ "@/views/caseShow/bargaining/ActivityShow.vue")
  },
  {
    path: '/caseShow/voteplugin/ActivityShow/:id',
    name: '投票',
    component: () => import(/* webpackChunkName: "about" */ "@/views/caseShow/voteplugin/ActivityShow.vue")
  },
  {
    path: '/caseShow/moresolitaire/ActivityShow/:id',
    name: '多商品团购接龙',
    component: () => import(/* webpackChunkName: "about" */ "@/views/caseShow/moresolitaire/ActivityShow.vue")
  },
  {
    path: "/caseShow/moresolitaire/ApplyForm",
    name: "报名详情",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/moresolitaire/ApplyForm.vue"),
  },
  {
    path: '/caseShow/voteplugin/voteranking',
    name: '投票排行',
    component: () => import(/* webpackChunkName: "about" */ "@/views/caseShow/voteplugin/voteranking.vue")
  },
  {
    path: "/caseShow/bargaining/OrderDetails",
    name: "帮砍详情",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/bargaining/OrderDetails.vue"),
  },
  {
    path: "/caseShow/bargaining/ApplyForm",
    name: "报名详情",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/bargaining/ApplyForm.vue"),
  },
  {
    path: "/caseShow/bargaining/ApplyFormKJ",
    name: "砍价支付",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/bargaining/ApplyFormKJ.vue"),
  },
  {
    path: "/caseShow/bargaining/GroupOrder",
    name: "砍价订单",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/bargaining/GroupOrder.vue"),
  },
  {
    path: "/caseShow/voteplugin/applyForm",
    name: "我要报名",
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/caseShow/voteplugin/ApplyForm.vue"),
  },
];
const IS_DEV = process.env.NODE_ENV === 'development';
const router = new VueRouter({
  //mode、base还要区分开发与生产 开发url是在根目录,开发时history模式刷新会error，应该是本机的服务器未配置
  //当mode为hash时候发现base未产生左右，故开发用hash模式，生产用history模式 防止url上带#，百度统计等拿不到#后面的参数，也是美化url
  // mode: 'history',
  // mode: IS_DEV?'hash':'history',//history模式没有井号，默认为hash，有井号
  // base: '/'+location.pathname.split('/')[1]+'/'+location.pathname.split('/')[2],//取到两级的目录 后面都是路由
  routes
})

// 路由守卫
router.beforeEach((to,from,next)=>{
  if(!to.meta.isShowTabbar) {
    console.log(to.name, 'to.name131---');
    document.title = to.name;
  }
  next();
  // if(to.matched.some(res=>res.meta.isLogin)){//判断是否需要登录
  //     if (sessionStorage['username']) {
  //         next();
  //     }else{
  //         next({
  //             path:"/login",
  //             query:{
  //                 redirect:to.fullPath
  //             }
  //         });
  //     }

  // }else{
  //     next()
  // }
});
export default router
